local storyboard = require "storyboard"


local scene = storyboard.newScene()

function scene:createScene( event )
    local group = self.view    
    
    for i = 1, 5 do
        local levelButton = display.newRect( 85 * (i-1), 100, 80, 80 )
        group:insert( levelButton )
        local function doTouch(self, event)        
            if event.phase == "began" then
                storyboard.gotoScene("LevelScene",{params ={level = i}})
                return true
            end
        end
        
        levelButton.touch = doTouch
        levelButton:addEventListener("touch", levelButton)
    end
    
end

scene:addEventListener( "createScene", scene )

function scene:enterScene( event )  
    storyboard.removeScene( "LevelScene" )
    print("enter LS")
end

scene:addEventListener( "enterScene", scene )

return scene
